package ru.dcsearch.indexer;

/***************************************************************************
 *   Modified by TMC
 *   berechitai@gmail.com
 *
 *   This file is part of DC Indexer project
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 ***************************************************************************/
/*
 * This file is part of Mobile DC.
 */

/*
 * Copyright (C) 2001 Stefan Görling, stefan@gorling.se
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

import java.io.*;


public class ExtendedBufferedOutputStream extends BufferedOutputStream {
    protected int bufferSize = 0;

    public ExtendedBufferedOutputStream(OutputStream out) {
        super(out);
        bufferSize = 512; // default buffer size.
    }

    public ExtendedBufferedOutputStream(OutputStream out, int size) {
        super(out, size);
        bufferSize = size;
    }

    // returns the number of bytes that can be written without blocking.
    public int nonBlockingCapacity() {
        return bufferSize - bytesInBuffer();
    }

    // Returns the number of bytes in the buffer
    public int bytesInBuffer() {
        return count;
    }
}
